<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>我的认证-个人中心-<?=_get_config('sitename')?></title>
<?php include_once(VIEWPATH."public/header_title.php");?>
<link href="<?php echo _get_cfg_path('css')?>base.css" type="text/css" rel="stylesheet" />
<link href="<?php echo _get_cfg_path('css')?>common.css" type="text/css" rel="stylesheet" />
<link href="<?php echo _get_cfg_path('lib')?>uploadify/uploadify.css" type="text/css" rel="stylesheet" />
<!--[if IE 6]>
<script src="js/DD_belatedPNG.js" type="text/javascript" ></script>
<script>DD_belatedPNG.fix('a,img');</script>
<![endif]-->
</head>
<body>
<?php include_once(VIEWPATH."public/header.php");?>
<div class="mainbody" id="mainbody">
    <div class="container mrgB30">
        <div class="member clearfix">
            <?php include_once(VIEWPATH."m/public/left_menu.php");?>
            <div class="fr uc_content">
              <?php include_once(VIEWPATH."m/public/notice.php");?>
                <div class="clearfix uitopg">
                  <div class="fl um_uitop">
                      <div class="authent">
                          <div class="aut_bti">我的认证</div>
                          <input type="hidden" id="user_type_cert" value="<?=$usertype?>"/>
                     <?php $res = $this->input->get('res');
                              if($this->input->get('res'))
                              {
                                $msg = '提交失败';
                                if($res==200)
                                  $msg = '提交成功';
                                  echo '<div class="authent_status"><i></i>'.$msg.'</div>';
                              }?>
                              <?php if($o && ($o['status']==1 || $o['status']==2) ):?>
                                <?php if($o['status']==1):?>
                                 <div class="authent_status"><i></i>认证成功</div>
                                <?php else:?>
                                  <div class="authent_status"><i></i>缴费中</div>
                                <?php endif?>
                            <table class="aut_tab" width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tbody>
                                <tr>
                                	<td colspan="2"><div style="color:#e2235b;">认证资料</div></td>
                                </tr>
                                <?php if (in_array($usertype, array(2, 3))) :?>
                                <?php if ($usertype == 2):?>
                                <tr>
                                    <td>
                                    	<!--<?php //if (2 == $usertype):?>机构类型<?php //else: ?>企业类型<?php //endif;?>-->
                                    	类&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;型
                                    </td>
                                    <td>
                                        <?php echo $oTypeStr;?>
                                    </td>
                                </tr>
                                <?php endif;?>
                                <tr>
                                    <td>
                                    	<!--<?php //if (2 == $usertype):?>机构全称<?php //else :?>企业全称<?php //endif;?>-->
                                    	全&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;称
                                    </td>
                                    <td><?php echo $o['company']?></td>
                                </tr>
                                <?php if ($usertype == 3):?>
                                <tr>
                                    <td>
                                    	类&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;型
                                    </td>
                                    <td>
                                        <?php echo $oTypeStr;?>
                                    </td>
                                </tr>
                                <?php endif;?>
                                <tr>
                                    <td>联系电话：</td>
                                    <td><?php echo $o['com_tel']?></td>
                                </tr>
                                <tr>
                                    <td>地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址：</td>
                                    <td><?php echo $o['com_prov'].$o['com_city'].$o['com_dist'].$o['com_address']?></td>
                                </tr>
                                <tr>
                                    <td>网&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址</td>
                                    <td><?php echo $o['com_website']?></td>
                                </tr>
                                <!-- <tr>
                                	<td>logo：</td>
                                     <td><img src="<?php echo '/'.$o['com_logo']?>"/></td>
                                </tr> -->
                                <tr>
                                    <td>
                                    	<?php if ($usertype == 2):?>
                                    		认证公函/营业执照：
                                    	<?php elseif ($usertype == 3):?>
                                    		企业公函/营业执照
                                    	<?php endif;?>
                                    </td>
                                    <td><img style="max-width:500px;" src="<?php echo '/'.$o['idnoimg']?>"/></td>
                                </tr>
                                <!-- <tr><td><div style="color:#e2235b;">联系人信息</div></td></tr> -->
                                <?php endif?>
                                <?php if ($usertype != 2 && $usertype != 3):?>
	                                <?php if ($usertype == 6):?>
	                                	<tr>
	                                		<td>类&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;型：</td>
	                                		<td><?=$oTypeStr?></td>
	                                	</tr>
	                                <?php endif;?>
                                <tr>
                                    <td width="86"><?php if (!in_array($usertype, array(2,3))){?>真实姓名：<?php }else {?>联系人姓名: <?php }?></td>
                                  <td><?=$o['realname']?></td>
                                </tr>
                                <tr>
                                  <td>身份证号：</td>
                                  <td><?=$o['idno']?></td>
                                </tr>
                                <tr>
                                  <td>手机号码：</td>
                                  <td><?=$o['mobile']?></td>
                                </tr>
                                <tr>
                                   <td>邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;箱：</td>
                                   <td><?php echo $o['email']?></td>
                                </tr>
                                <tr>
                                  <?php if(!in_array($usertype, array(2, 3))) :?>
                                  <td>身份证照片：</td>
                                  <td>
                                      <img style="max-width:200px;" border=0 src='<?php echo '/'.$o['idnoimg'];?>'>
                                  </td>
                                  <?php endif?>
                                </tr>
                                <?php endif;?>
                                <!--<tr>
                                  <td>工作担保金</td>
                                  <td><input class="money" type="text" value="¥ <?=$o['bail']?>" disabled=""><span class="remark">备注：担保金在注销账号时，返予您的账户。</span></td>
                                </tr>-->
                            </tbody></table>
                          <?php else:?>
                            <?php if($o && $o['status']==-1):?>
                              <div class="authent_status"><i style="background:url(<?=_get_cfg_path('images').'cert_no.png'?>) no-repeat"></i>认证失败</div>
                            <?php endif?>
                          <form method="post" action="" id="xtform">
                            <table class="aut_tab" width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tbody>
                                <?php if(in_array($usertype, array(2, 3))) {?>   
                                <tr>
                                	<td><div style="color:#e2235b;"><?php if (2== $usertype) {?>认证资料<?php }else{?>企业基本资料<?php }?></div></td>
                                	<td>
                                		<a style="float:right;" href="javascript:void(0);" class="edit_ope show_info"><?=$o['company']?'修改':'申请认证'?></a>
                                		<input type="hidden" value="<?=$o['company']?'1':'2'?>" id="show_hidden_flag"/>
                                	</td>
                                </tr>
                                <?php if ($usertype == 2):?>
                                	<tr>
	                                   <td>
	                                   	<span class="tips">*</span>
	                                   	类&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;型
	                                   </td>
	                                   <td class="show_info">
	                                   	<?=$oTypeStr?>
	                                   </td>
	                                   <td class="institution_type edit_info">
	                                      <?php foreach ($oSysType as $key => $v):?>
		                                    <input  class="ck" type="checkbox" name="type[]" onclick="checktype(this)" value="<?=$key?>"<?php if(strpos(','.$o['com_type'].',', ','.$key.',')>-1) echo ' checked';?> /><?=$v?>
		                                  <?php endforeach;?>
	                                   </td>                        
	                              	</tr>
	                                <tr>
	                                	<td>
	                                		<span class="tips">*</span>
	                                		<span class="com_name_ins">全&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;称</span>
	                                	</td>
	                                	<td class="show_info"><?=$o['company']?></td>
	                                    <td class="edit_info"><input id="comName"  name="company" type="text" class="txt" placeholder="请输入名称" value="<?php echo !empty($o['company']) ? $o['company'] : ''?>"></td>
	                                </tr>
                                <?php else:?>
	                                <tr>
	                                	<td>
	                                		<span class="tips">*</span>
	                                		全&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;称
	                                	</td>
	                                	<td class="show_info"><?=$o['company']?></td>
	                                    <td class="edit_info"><input id="comName"  name="company" type="text" class="txt" placeholder="请输入机构名称" value="<?php echo !empty($o['company']) ? $o['company'] : ''?>"></td>
	                                </tr>
	                                <tr>
	                                   <td>
	                                   	<span class="tips">*</span>
	                                   	类&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;型
	                                   </td>
	                                   <td class="show_info"><?=$oTypeStr?></td>
	                                   <td class="edit_info">
	                                     <?php foreach ($oSysType as $key => $v):?>
	                                    <input  class="ck" type="checkbox" name="type[]" onclick="checktype(this)" value="<?=$key?>"<?php if(strpos(','.$o['com_type'].',', ','.$key.',')>-1) echo ' checked';?> /><?=$v?>
	                                  <?php endforeach;?>
	                                   </td>                        
	                              	</tr>
                                <?php endif;?>
                                <tr>
                                	<td><span class="tips">*</span>联系电话</td>
                                	<td class="show_info"><?=$o['com_tel']?></td>
                                    <td class="edit_info"><input id="com_telphone" name="com_telphone" type="text" class="txt" placeholder="请输入联系电话" value="<?php echo !empty($o['com_tel']) ? $o['com_tel'] : ''?>"/></td>
                                </tr>
                                <tr class="ins_per_show">
                                    <td><span class="tips">*</span>地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址</td>
                                    <td class="show_info">
                                    	<?=$o['com_address']?>
                                    </td>
                                    <td class="edit_info">
                                      <div id="city_4" style="margin-top:8px">
                                          <select class="prov txt" style="width:100px;margin-right:10px;" name="prov"></select> 
                                          <select class="city txt" style="width:100px;margin-right:10px;" name="city" disabled="disabled"></select>
                                          <select class="dist txt" style="width:100px" name="dist" disabled="disabled"></select>
                                      </div>
                                      <p style="padding:8px 0;">
                                          <input id="address" style="width:314px" name="street" type="text" class="txt" placeholder="街道/门牌号" value="<?php echo !empty($o['com_address']) ? $o['com_address']: ''?>"/>
                                      </p>
                                    </td>
                                </tr>
                                <tr class="ins_per_show">
                              	  <td><span class="tips">*</span>网&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址</td>
                              	  <td class="show_info"><?=$o['com_website']?></td>
                                  <td class="edit_info"><input id="website" name="website" type="text" value="<?php echo $o['com_website']?>" class="txt" placeholder="公司官方网址"/></td>
                              	</tr>
                              	
                                <!-- <tr>
                                    <td><span class="tips">*</span>logo</td>
                                    <td>
                                      <div id="previews" class="drsMoveHandle">
                                          <img id="show_idnoimg3" border=0 src='<?php if(!empty($o['com_logo'])) echo '/'.$o['com_logo'];?>'>
                                      </div>
                                      <div class="f_note">
                                          <p>尺寸：180×180像素</p>
                                          <input type="hidden"  name="idnoimg3" id="idnoimg3" value="<?php if(!empty($o['com_logo'])) echo $o['com_logo']?>">
                                          <em><i class="icoPro16"></i>仅支持JPEG，上传图片大小不能超过1M</em>
                                          <div class="file_but">
                                          		<input name="showimg_upload" value="选择展示图" type-data="选择展示图" length-data="180" height-data="180" imgid-data="show_idnoimg3" imgval-data="idnoimg3" class="cut_pic showimg_upload" type="button"/>
                                          </div>
                                      </div>                                      
                                    </td>
                                </tr> -->
                                <tr>
                                   <td style="min-width:90px;">
                                   		<span class="tips">*</span>
                                   		<span class="cert_img_ins">
                                    	<?php if ($usertype == 2):?>
                                    		认证公函/营业执照：
                                    	<?php else:?>
                                    		企业公函/营业执照：
                                    	<?php endif;?>
                                    	</span>
                                   </td>
                                   <td class="show_info"><img style="max-width:200px;" border=0 src='<?php echo '/'.$o['idnoimg'];?>'></td>
                                   <td class="edit_info">
                                      <div id="previews" class="drsMoveHandle">
                                          <img id="show_idnoimg2" border=0 src='<?php if(!empty($o['idnoimg'])) echo '/'.$o['idnoimg'];?>'>
                                      </div>
                                      <div class="f_note ">
                                          <p class="cert_per_ins"><?php if ($usertype!=3):?>尺寸：660×400像素<?php endif;?></p>
                                          <input type="hidden"  name="idnoimg2" id="idnoimg2" value="<?php if(!empty($o['idnoimg'])) echo $o['idnoimg']?>">
                                          <em><i class="icoPro16"></i>
                                          	<span class="cert_img_ins_per">
	                                          	<?php if ($usertype == 2):?>
	                                          		<a style='color:blue;text-decoration:underline;' href='/assets/src/cert/企业认证申请公函.doc'>企业认证申请公函.doc</a>
	                                          	<?php else :?>
	                                          		<a style='color:blue;text-decoration:underline;' href='/assets/src/cert/企业认证申请公函.doc'>企业认证申请公函.doc</a>
	                                          	<?php endif;?>
                                          	</span>
                                          </em>
                                          <div class="file_but">
                                              <input id="idnoimg2_upload" name="idnoimg2_upload" value="选择身份证" class="inp_file" type="file">
                                          </div>
                                      </div>                                      
                                  </td><?php }?>
                                </tr>
                                <?php if ($usertype != 2 && $usertype != 3):?>
                                <?php if (in_array($usertype, array(2, 3))) { 
                                    $str = '联系人信息';
                                    $nameStr = '联系人姓名'; 
                                 } else { 
                                    $str = '认证资料';
                                    $nameStr = '真实姓名';
                                 }?>
                                <tr>
                                	<td><div style="color:#e2235b;"><?php echo $str?></div></td>
                                	<td>
                                		<a style="float:right;" href="javascript:void(0);" class="edit_ope"><?=$o['realname']?'修改':'申请认证'?></a>
                                		<input type="hidden" value="<?=$o['realname']?'1':'2'?>" id="show_hidden_flag"/>	
                                	</td>
                                </tr>
                                <?php if ($usertype == 6):?>
                                	<tr>
                                		<td>
	                                   	<span class="tips">*</span>
	                                   	类&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;型
	                                   </td>
	                                   <td class="show_info">
	                                   		<?=$oTypeStr?>
	                                   </td>
	                                   <td class="edit_info">
	                                     <?php if ($o['com_type']):?>
	                                     	<input type="hidden" value="<?=$o['com_type']?>" name="type"/>
	                                     	<?=$oTypeStr?>
	                                     <?php else :?>
		                                     <?php foreach ($oSysType as $key => $v):?>
		                                     <input  class="ck" type="radio" name="type" value="<?=$key?>"<?php if(strpos(','.$o['com_type'].',', ','.$key.',')>-1) echo ' checked';?> /><?=$v?>
		                                  	 <?php endforeach;?>
	                                  	 <?php endif;?>
	                                   </td>               
                                	</tr>
                                <?php endif;?>
                                <tr>
                                  <td width="86"><span class="tips">*</span><?php echo $nameStr?></td>
                                  <td class="show_info">
                                  	<?=$o['realname']?>
                                  </td>
                                  <td class="edit_info"><input id="truename" name="realname" type="text" class="txt" value="<?php echo !empty($o['realname'])?$o['realname']:$this->loginUser['realname']; ?>" placeholder="请输入姓名"></td>
                                </tr>
                                <tr>
                                   <td><span class="tips">*</span>身份证号</td>
                                   <td class="show_info"><?=$o['idno']?></td>
                                  <td class="edit_info"><input id="idno" name="idno" type="text" class="txt" placeholder="请输入身份证" value="<?php if(!empty($o['idno'])) echo $o['idno']?>"></td>
                                </tr>
                                <tr>
                                  <td><span class="tips">*</span>手机号码</td>
                                  <td class="show_info"><?=$o['mobile']?></td>
                                  <td class="edit_info"><input id="mobilee" name="mobile" type="text" class="txt" placeholder="请输入手机号码" value="<?php echo !empty($o['mobile'])?$o['mobile']:$this->loginUser['mobile']; ?>"></td>
                                </tr>
                                <?php if ($usertype == 3):?>
                                <tr>
                                  <td><span class="tips">&nbsp;</span>支付宝账户</td>
                                  <td class="show_info"><?=$o['alipay']?></td>
                                  <td class="edit_info"><input id="alipay" name="alipay" type="text" class="txt" placeholder="请输入支付宝账户" value="<?php echo !empty($o['alipay'])?$o['alipay']:"" ?>"></td>
                                </tr>
                                <?php endif;?>
                                <tr>
                                	<td><span class="tips">*</span>邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;箱</td>
                                	<td class="show_info"><?=$o['email']?></td>
                                    <td class="edit_info"><input id="emaill" name="email" type="text" class="txt" placeholder="请输入邮箱" value="<?php echo !empty($o['email']) ? $o['email'] : '';?>"/></td>
                                </tr>
                                <tr>
                                   <?php if(!in_array($usertype, array(2, 3))){?>
                                  <td><span class="tips">*</span>身份证照片</td>
                                  <td class="show_info">
                                  	<img style="max-width:200px;" border=0 src='<?php echo '/'.$o['idnoimg'];?>'>
                                  </td>
                                  <td class="edit_info">
                                      
                                          <div id="previews" class="drsMoveHandle">
                                              <img id="show_idnoimg" border=0 src='<?php if(!empty($o['idnoimg'])) echo '/'.$o['idnoimg'];?>'>
                                          </div>
                                          <div class="f_note ">
                                              <p>尺寸：400*240像素</p>
                                              <input type="hidden"  name="idnoimg" id="idnoimg" value="<?php if(!empty($o['idnoimg'])) echo $o['idnoimg']?>">
                                              <em><i class="icoPro16"></i>仅支持JPEG，上传图片大小不能超过1M</em>
                                              <div class="file_but">
                                                  <input id="idnoimg_upload" name="idnoimg_upload" value="选择身份证" class="inp_file" type="file">
                                              </div>
                                          </div>
                                  </td>
                                   <?php }?>
                                </tr>
                                <?php endif;?>
                                <!--<tr>
                                  <td>所属经纪公司</td>
                                  <td><input name="company" type="text" class="txt" placeholder="请输入所属经纪公司" value="<?php if(!empty($o['company'])) echo $o['company'];?>"></td>
                                </tr>-->
                                <tr class="edit_info">
                                  <td style="height:80px">&nbsp;</td>
                                  <td><input  id='submit'  name="" type="submit" class="but" value="提交认证"></td>
                                </tr>
<!--                            <tr>
                                  <td>工作担保金</td>
                                  <td><input class="money" type="text" value="¥ <?php if(!empty($o['bail'])) echo $o['bail']; else echo $sysBail;?>" disabled="">
                                      <input name="bail" type="hidden" value="<?php if(!empty($o['bail'])) echo $o['bail']; else echo $sysBail;?>"><span class="remark">备注：担保金在注销账号时，返予您的账户。</span>    <a class="but" style="height:30px" href="/m/cert/gotopay" target="_blank">前去缴纳</a></td>
                                </tr>-->
                                <!--<tr style="border-bottom:none;">
                                  <td style="height:80px">&nbsp;</td>
                                  <td><a class="but" href="/m/cert/gotopay" target="_blank">前去缴纳</a></td>
                                </tr>-->
                            </tbody></table>
                          </form>
                          <?php endif?>
                        </div>
                    </div>
                    <div class="fr um_wind">
                      <?php include_once(VIEWPATH."m/public/right.php");?>
                    </div>
                </div>
            </div>
        </div>
        <div class="help_bottom"></div>
    </div> 
</div>
<!--mainbody-->

<!-- 弹出层 -->
<div class="popover-mask"></div>
<div class="popover complaint popover_works" style="height:auto;margin:-260px 0 0 -230px;">
    <div class="compl_top">
        <span class="fl" id="X-title">添加图片</span>
        <a href="javascript:;" id="TX-win-close" title="关闭" class="close fr">×</a></div>
  <div class="compl_con">
      <form action="/public/upload/catupload" method="post" id="catupload_form" enctype="multipart/form-data">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <input type="hidden" name="albumid" id="albumid" value=""/>
            <input type="hidden" name="agid" id="agid" value="<?=$this->input->get('agid')?>"/>
            <tr><td height="10"></td></tr>
            <tr>
              <td width="80"><font id="pic_label">照片：</font></td>
              <td>
              	<div class="filebox" style="height:91px;">
              	 <input type="hidden" name="width" id="length_size" />
              	 <input type="hidden" name="height" id="height_size" />
              	 <input type="hidden" name="rel_width" id="rel_width_size"/>
              	 <input type="hidden" name="rel_height" id="rel_height_size"/>
              	 <input type="hidden" id="img_url" />
              	 <input type="hidden" id="img_val" />
                 <div class="upload_btn photo_left_bg" style="top:0px;">
                    <a href="javascript:" style="text-align:center;margin-top:10px;">选择图片<input type="file" onChange="catimg_upload(this)" id="cover" name="cover"></a>
                    <br/>
                    <span style="margin-left:20px;">支持JPG/PNG/GIF，上传图片大小不能超过1M</span>
                 </div>
              	   <div class="left fl">
                     <div id="localImag"><img id="preview1" src="" style="display:none;"/></div>
                     <!--通过生成尺寸和旋转角度 后台获取尺寸和旋转角度再进行裁剪-->
                     <input id="id_top" type="hidden" name="top" value="0">  <!--x轴-->
                     <input id="id_left" type="hidden" name="left" value="0"><!--y轴-->
                     <input id="id_right" type="hidden" name="right" value="0"><!--w轴-->
                     <input id="id_bottom" type="hidden" name="bottom" value="0"><!--h轴-->
                     <input id="id_widthPro" type="hidden" name="widthPro" value=""><!--宽度比例，原：现-->
                     <input id="id_heightPro" type="hidden" name="heightPro" value=""><!--高度比例，原：现-->
                     <input id="rotation" type="hidden" value="0" name="rotation">
                   </div>
                </div>
              </td>
            </tr>
            <tr><td height="10"></td></tr>
            <tr><td height="10"></td></tr>
            <tr>
              <td>&nbsp;</td>
              <td><input class="but commit_album" name="" onclick="catimg_save()"  type="button" value="保存"/><span id="T-msg"></span></td>
            </tr>
        </table>
      </form>
    </div>
</div>

<?php include_once(VIEWPATH."public/footer.php");?>
</body>
<script type="text/javascript" src="<?php echo _get_cfg_path('js')?>jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="<?=_get_cfg_path('js')?>jquery.imgareaselect.js"></script>
<script type="text/javascript" src="<?php echo _get_cfg_path('js')?>common.js"></script>
<script type="text/javascript" src="<?php echo _get_cfg_path('js')?>jquery.SuperSlide.2.1.1.js"></script>
<script>jQuery(".txtScroll-top").slide({titCell:".hd ul",mainCell:".bd ul",autoPage:true,effect:"topLoop",autoPlay:true});</script>
<script type="text/javascript" src="<?php echo _get_cfg_path('js')?>jquery.validate.min.js"></script>
<script type="text/javascript" src="<?php echo _get_cfg_path('js')?>pages/m/cert.js"></script>
<script src="<?php echo _get_cfg_path('lib')?>uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
<script type="text/javascript" src="<?php echo _get_cfg_path('js')?>jquery.cityselect.js"></script>
<script type="text/javascript" src="<?php echo _get_cfg_path('js')?>pages/m/ajaxfileupload.js"></script>
<script type="text/javascript" src="<?php echo _get_cfg_path('js')?>pages/m/info.js"></script>
<script type="text/javascript">
$(function(){
	//demo04
	$("#city_4").citySelect({
    	prov:"<?php echo !empty($o['com_prov']) ? $o['com_prov']: '';?>", 
    	city:"<?php echo !empty($o['com_city']) ? $o['com_city'] : ''?>",
        dist:"<?php echo !empty($o['com_dist']) ? $o['com_dist'] : ''?>",
        nodata:"none"
	}); 

});

//机构类型选择限定数量
function checktype(obj)
{
	var arr = $("input[name='type[]']:checked");
	if(arr.length > 3)
	{
		alert("最多可选3个");
		$(obj).attr("checked",false);
	}
}
</script>

<script type="text/javascript">
<?php $timestamp = $this->timestamp;?>
$(function() {
  setTimeout(function(){
    $('#idnoimg_upload').uploadify({
      'formData'     : {
        'timestamp' : '<?php echo $timestamp;?>',
        'token'     : '<?php echo md5($this->config->item('encryption_key') . $timestamp );?>',
        'type' : 'idnoimg',
        'uid' : <?php echo $this->loginID;?>
      },
      'auto':true,
      //'buttonClass':'inp_btn',
      'fileSizeLimit' : '1024KB',
      'buttonText':'选择照片',
      'fileTypeExts': '*.jpg;*.png;*.jpeg',
      //'buttonImage' : '{$js_url}uploadify/button.png',
      'swf'      : '<?php echo _get_cfg_path("lib")?>uploadify/uploadify.swf',
      'uploader' : '/public/upload/uploadimg',
      'onUploadSuccess' : function(file, data, response) {
        if (!data){
         alert('上传失败');
         return;
        }
        data = data.split('|');
        if (data[0] == 100){
          $('#idnoimg').nextAll('em').html('<i class="icoErr16"></i>'+data[1]);
        }else if(data[0] == 200 && data[1]!=''){
          var imgpath=data[1];
          $('#idnoimg').val(imgpath);
          $('#idnoimg').nextAll('em').html('<i class="icoCor16"></i>');
          $('#show_idnoimg').attr('src','/'+imgpath);
        }
      }
    });
  },10);
});

$(function() {
  setTimeout(function(){
    $('#idnoimg2_upload').uploadify({
      'formData'     : {
        'timestamp' : '<?php echo $timestamp;?>',
        'token'     : '<?php echo md5($this->config->item('encryption_key') . $timestamp );?>',
        'type' : 'idnoimg2',
        'uid' : <?php echo $this->loginID;?>
      },
      'auto':true,
      //'buttonClass':'inp_btn',
      'fileSizeLimit' : '1024KB',
      'buttonText':'选择照片',
      'fileTypeExts': '*.jpg;*.png;*.jpeg',
      //'buttonImage' : '{$js_url}uploadify/button.png',
      'swf'      : '<?php echo _get_cfg_path("lib")?>uploadify/uploadify.swf',
      'uploader' : '/public/upload/uploadimg',
      'onUploadSuccess' : function(file, data, response) {
        if (!data){
         alert('上传失败');
         return;
        }
        data = data.split('|');
        if (data[0] == 100){
          $('#idnoimg2').nextAll('em').html('<i class="icoErr16"></i>'+data[1]);
        }else if(data[0] == 200 && data[1]!=''){
          var imgpath=data[1];
          $('#idnoimg2').val(imgpath);
          $('#idnoimg2').nextAll('em').html('<i class="icoCor16"></i>');
          $('#show_idnoimg2').attr('src','/'+imgpath);
        }
      }
    });
  },10);
});

$(function() {
  setTimeout(function(){
    $('#idnoimg3_upload').uploadify({
      'formData'     : {
        'timestamp' : '<?php echo $timestamp;?>',
        'token'     : '<?php echo md5($this->config->item('encryption_key') . $timestamp );?>',
        'type' : 'idnoimg3',
        'uid' : <?php echo $this->loginID;?>
      },
      'auto':true,
      //'buttonClass':'inp_btn',
      'fileSizeLimit' : '1024KB',
      'buttonText':'选择照片',
      'fileTypeExts': '*.jpg;*.png;*.jpeg',
      //'buttonImage' : '{$js_url}uploadify/button.png',
      'swf'      : '<?php echo _get_cfg_path("lib")?>uploadify/uploadify.swf',
      'uploader' : '/public/upload/uploadimg',
      'onUploadSuccess' : function(file, data, response) {
        if (!data){
         alert('上传失败');
         return;
        }
        data = data.split('|');
        if (data[0] == 100){
          $('#idnoimg3').nextAll('em').html('<i class="icoErr16"></i>'+data[1]);
        }else if(data[0] == 200 && data[1]!=''){
          var imgpath=data[1];
          $('#idnoimg3').val(imgpath);
          $('#idnoimg3').nextAll('em').html('<i class="icoCor16"></i>');
          $('#show_idnoimg3').attr('src','/'+imgpath);
        }
      }
    });
  },10);
});
</script>
</html>
<script>
//js 验证
$(function(){

	$('#submit').on('click',function(){
		var user_type_cert = $("#user_type_cert").val();
		//手机号mobilee
		function phoneReg(phone){
			var reg=/^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
			var result=reg.test(phone)? true:false ;
			return result;
		}
		if(user_type_cert == 2 || user_type_cert == 3)
		{
			if(user_type_cert == 2)
			{
				var type = $("input[name='type[]']:checked").val();
				if(type == undefined || type == "")
				{
					alert("请选择类型");
					return false;
				}

				//机构
				var comName = $.trim($("#comName").val());
				if(comName == undefined || comName == "")
				{
					alert("请输入全称");
					return false;
				}
				var com_telphone = $.trim($("#com_telphone").val());
				if(com_telphone == undefined || com_telphone == "")
				{
					alert("请输入联系电话");
					return false;
				}
				function checkPhone(str)
				{
				    var re = /^0\d{2,3}-?\d{7,8}$/;
				    return re.test(str)?true:false;
				}
				if(!phoneReg(com_telphone) && !checkPhone(com_telphone))
				{
					alert("电话格式错误");
					return false;
				}
				//地址
				var address = $.trim($('#address').val());
				if(address==null || address=='')
				{
					alert("请输入地址");
					return false;
				}
				//网址
				function checkoutWebsite(str)
				{
					var re = /^(http?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/;
					return re.test(str)?true:false;
				}
				var website = $.trim($('#website').val());
				if(website==null || website=='')
				{
					alert("请输入网址");
					return false;
				}
				if(!checkoutWebsite(website))
				{
					alert("网址格式不正确");
					return false;
				}
				if($("#idnoimg2").val() == undefined || $("#idnoimg2").val() == "")
				{
					alert("请上传认证公函/营业执照");
					return false;
				}
					
			}
			else
			{
				//企业全称
				if($('#comName').val()==null || $('#comName').val()=='')
				{
					alert("请输入全称");
					return false;
				}
				//企业类型
				var checkNum=0;
				var check=$('.ck');
				//console.log(check[0]);
				for(var i=0;i<check.length;i++)
				{
					if(check[i].checked==true)
					{
						checkNum++;
					}
				}
				if(checkNum==0)
				{
					alert("请选择企业类型");
					return false;
				}
				//电话
				function checkPhone(str)
				{
				    var re = /^0\d{2,3}-?\d{7,8}$/;
				    return re.test(str)?true:false;
				}
				var com_telphpone = $.trim($('#com_telphone').val());
				if(com_telphpone == '')
				{
					alert("请输入联系电话");
					return false;
				}
				if (!checkPhone(com_telphpone) && !phoneReg(com_telphpone))
				{
					alert("联系电话格式不正确");
					return false;
				}
				//地址
				var address = $.trim($('#address').val());
				if(address==null || address=='')
				{
					alert("请输入地址");
					return false;
				}
				//网址
				function checkoutWebsite(str)
				{
					var re = /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/;
					return re.test(str)?true:false;
				}
				var website = $.trim($('#website').val());
				if(website==null || website=='')
				{
					alert("请输入网址");
					return false;
				}
				if(!checkoutWebsite(website))
				{
					alert("网址格式不正确");
					return false;
				}
// 				//验证logo
// 				var logo_img = $("#idnoimg3").val();
// 				if(logo_img == null || logo_img == '')
// 				{
// 					alert("请上传logo图片");
// 					return false;
// 				}
				//验证营业执照
				var business_img = $("#idnoimg2").val();
				if(business_img == null || business_img == '')
				{
					alert("请上传企业公函/营业执照");
					return false;
				}	
			}
		}

		if(user_type_cert != 2 && user_type_cert != 3)
		{
			//身份truename
			var truename = $.trim($('#truename').val());
			if(truename==null || truename=='')
			{
				alert("请输入姓名");
				return false;
			}
			//验证身份证
			function idnoCheck(idcard)
			{
				var bo=/^(\d{6})(18|19|20)?(\d{2})([01]\d)([0123]\d)(\d{3})(\d|X)?$/.test(idcard);
				var year = idcard. substr(6,4);
				var month = idcard. substr(10,2);
				var day = idcard. substr(12,2);
				if(bo==false||month>12||day>31)
					return false;
				return true;
			}
			//身份证号
			var idno = $.trim($('#idno').val());
			if(idno==null || idno=='')
			{
				alert("请输入身份证号码");
				return false;
			}
			if(!idnoCheck(idno))
			{
				alert("身份证输入错误");
				return false;
			}
			if (!phoneReg($('#mobilee').val()))
			{
				alert("手机号码格式不正确");
				return false;
			}
			//邮箱
			function emailReg(str){
				var reg=/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;
				var result=reg.test(str)? true:false ;
				return result;
			}
			var emailval = $.trim($("#emaill").val());
			if(emailval==null || emailval=='')
			{
				alert("请输入邮箱");
				return false;
			}
			if (!emailReg(emailval))
			{
				alert("邮箱格式不正确");
				return false;
			}
			if(user_type_cert == 1)
			{
				if($("#idnoimg").val() == null || $("#idnoimg").val() == "")
				{
					alert("请上传身份证照片");
					return false;
				}
			}
		}
		
	});		
});


</script>